﻿@model OPLWeb.Models.FixtureWrapper
@section LeftNav
{
    <ul id="nav-secondary" style="display: none;">
        <li><a href="Fixtures/First-Team.html">First Team</a></li><li><a href="Fixtures/Premier-League-Table.html">
            Premier League Table</a></li><li><a href="Fixtures/EDS.html">EDS</a></li><li><a href="Fixtures/Academy.html">
                Academy</a></li></ul>
}
<div id="content-wrapper">
    <div id="content-main-feature">
        <img alt="Next games" src="@Url.Content("~/content/images/content-main-feature-image-fixtures.jpg")">
        <div class="cmf-inner">
            <h2 class="white-60">
                Next game</h2>
            <ul>
                <li>
                    <img src="@Url.Content("~/content/icons/256x256/" + @Model.NextGame.Team.ID + ".png")"
                        alt="@Model.NextGame.Team.TeamName" width="140" height="140">
                    <div class="match-info">
                        <span id="content_0__16ede7bffc03_UpcomingFixtureList_ctl01_TicketStatusInfo" class="soldout">
                        </span>
                        <h3 class="white-24">
                            @Model.NextGame.Team.TeamName</h3>
                        <p>
                            Points : @Model.NextGame.Team.Points
                        </p>
                        <p class="competition">
                            Owned By : @(string.Join("/", Model.NextGame.Team.CrewTeams.Where(p => p.TeamId == Model.NextGame.Team.ID).Select(p => p.Crew.Name.Split(' ')[0])))</p>
                        <p class="date">
                            P/W/L : @Model.NextGame.Team.Matches / @(Model.NextGame.Team.Won.HasValue ? Model.NextGame.Team.Won.Value : 0)
                            / @(Model.NextGame.Team.Lost.HasValue ? @Model.NextGame.Team.Lost.Value : 0)
                        </p>
                    </div>
                </li>
                <li>
                    <img src="@Url.Content("~/content/images/versus.png")"
                        alt="Sporting Lisbon" width="140" height="140" />
                    <div class="match-info">
                        <span></span>
                        <h3 class="white-24">
                            Venue</h3>
                        <p>
                            Model Engg College Ground</p>
                        <p class="competition">
                            @Model.NextGame.Date.DayOfWeek.ToString()</p>
                        <p class="date">
                            @Model.NextGame.Date
                        </p>
                    </div>
                </li>
                <li>
                    <img src="@Url.Content("~/content/icons/256x256/" + @Model.NextGame.Team1.ID + ".png")"
                        alt="@Model.NextGame.Team1.TeamName" width="140" height="140">
                    <div class="match-info">
                        <span id="content_0__16ede7bffc03_UpcomingFixtureList_ctl03_TicketStatusInfo"></span>
                        <h3 class="white-24">
                            @Model.NextGame.Team1.TeamName</h3>
                        <p>
                            Points : @Model.NextGame.Team1.Points
                        </p>
                        <p class="competition">
                            Owned By : @(string.Join("/", Model.NextGame.Team1.CrewTeams.Where(p => p.TeamId == Model.NextGame.Team1.ID).Select(p => p.Crew.Name.Split(' ')[0])))</p>
                        <p class="date">
                            P/W/L : @Model.NextGame.Team1.Matches / @(Model.NextGame.Team1.Won.HasValue ? Model.NextGame.Team1.Won.Value : 0)
                            / @(Model.NextGame.Team1.Lost.HasValue ? @Model.NextGame.Team1.Lost.Value : 0)
                        </p>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div id="content-main">
        <div class="season-info">
            <div class="season-date">
                <h3 class="white-40">
                    @Model.FullFixture.FirstOrDefault().Season.SeasonName Fixtures</h3>
            </div>
        </div>
        <!-- /.season-info-->
        <div class="content-main-gutter">
            <ul class="content-main-buttons" style="display: none;">
                <li><a class="btn print" href="#" onclick="window.print(); return false;">Print this
                    page</a></li>
                <li><a id="content_0__16ede7bffc03_DownloadCalendar" class="btn calendar">Download calendar</a>
                </li>
                <li><a href="Fixtures/First-Team/Calendar-Instruction.html" class="btn calendar iframe">
                    Subscribe to calendar </a></li>
            </ul>
            @{int weekNum = 1;}
            @foreach (var week in Model.GroupedFixture)
            {
                <table cellspacing="0" class="fixtures">
                    <thead>
                        <tr>
                            <th colspan="8">
                                Week @weekNum of @week.Fixtures.FirstOrDefault().Season.SeasonName
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in week.Fixtures)
                        {
                            <tr id="content_0__16ede7bffc03_FixtureTable_MonthRepeater_ctl00_FixtureRepeater_ctl00_FixtureRow">
                                <td class="c1">
                                    @item.Date.ToString("dd MMMM yyyy")
                                </td>
                                <td class="c2 @(item.TeamWon.HasValue ? item.TeamWon.Value != item.TeamID1 ? "glow" : string.Empty : string.Empty)" style="font-size: larger">
                                    @item.Team.TeamName
                                </td>
                                <td class="c2" style="font-size: smaller">
                                    [@(string.Join("/", item.Team.CrewTeams.Where(p => p.TeamId == item.Team.ID).Select(p => p.Crew.Name.Split(' ')[0])))]
                                </td>
                                <td class="c2 @(item.TeamWon.HasValue ? item.TeamWon.Value != item.TeamID2 ? "glow" : string.Empty : string.Empty)" style="font-size: larger;">
                                    @item.Team1.TeamName 
                                </td>
                                <td class="c2" style="font-size: smaller">
                                    [@(string.Join("/", item.Team1.CrewTeams.Where(p => p.TeamId == item.Team1.ID).Select(p => p.Crew.Name.Split(' ')[0])))]
                                </td>
                                <td class="c8">
                                    @if (item.ManOfTheMatch.HasValue)
                                    { <a href="/Results/Index/@item.Id" class="next">Match report</a>}
                                    else
                                    { <a href="/Results/Index/@item.Id" class="next">Soon to update</a>}
                                </td>
                            </tr> 
                            
                        }
                    </tbody>
                </table>
                        weekNum++;

            }
            <div class="content-main-links" style="display: none;">
                <div class="side-link">
                    <a id="content_0__16ede7bffc03_ToggleSeasonListMode" class="next" href="Fixturesdf47.html?showall=1">
                        Show the full season</a>
                </div>
            </div>
        </div>
        <!-- /.content-main-gutter -->
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $('#nav-main > li').each(function () {
            $(this).removeClass('active');
        });
        $('#fixtures').addClass('active');
    });
</script>
